package com.http;

import java.io.InputStream;
import java.security.KeyStore;

import org.apache.http.conn.ssl.SSLSocketFactory;

import android.util.Log;

import com.dxyxx.R;
import com.nostra13.example.universalimageloader.UILApplication;

public class CustomSSLSocketFactory {
	private static final String TAG = "CustomSSLSocketFactory";
	private static final String KEY_PASS = "udh520";

	public static SSLSocketFactory getSocketFactory() {
		try {
			InputStream ins = UILApplication.getContext().getResources().openRawResource(R.raw.p123k);
			KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
			keyStore.load(ins, KEY_PASS.toCharArray());
			ins.close();
			SSLSocketFactory factory = new SSLSocketFactory(keyStore);
			return factory;
		} catch (Exception e) {
			Log.d(TAG, e.getMessage());
			e.printStackTrace();
		}
		return null;
	}
}